home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / kpascal.com / KPASCAL.DOC < prev    next >
Encoding:
Text File  |  1989-12-06  |  10.5 KB  |  272 lines

  1. KPASCAL Unit for TP 5.5
  2.  
  3. Type -  StringOf2;  StringOf80;  AttrStr;
  4. Var  -
  5.         Monochrome;     {boolean  true if monochrome monitor}
  6.     VideoBase;      {word     RAM base of video}
  7.     Cursor;         {boolean  true if cursor on}
  8.     Default_Attr;   {byte     default text attribute number}
  9.  
  10. (P)  CursorOn          - makes Cursor true - turns cursor on
  11. (P)  CursorOff         - makes Cursor false - turns cursor off
  12.  
  13. (F)  BStr(boolean)  : returns string "TRUE" or "FALSE"
  14. (F)  RStr(number)   : returns string or number with or w/o deci point
  15. (F)  ItoS(number,b) : returns string of integer, b is len of str
  16. (F)  RtoS(number,b1,b2)
  17.  |                  : returns string of real, b1 is len of str,
  18.  |                    b2 is # of decimals
  19. (F)  StoI(string)   : returns LongInt of string
  20. (F)  StoR(string)   : returns real of string
  21.  
  22. (F)  Caps(string)   : returns string in all caps
  23. (F)  StringOf(n,c)  : returns a string n long of c
  24. (F)  Trim(string)   : returns string with no spaces on end
  25.  
  26. (P)  ClrLn(y)          - Clears line y
  27. (P)  DoNothing         - does absolutely nothing
  28. (F)  SayAttr(attr)  : returns '`a###' AttrStr for attr (byte) in Say msg
  29. (F)  SayLen(number) : returns '`l##' for length in Say msg
  30. (P)  Say(x,y,msg)      - puts msg at x,y;
  31. (P)  SWrite(msg)       - 'emulate' Write using Say
  32. (P)  SWriteLn(msg)     - 'emulate' WriteLn using Say
  33.  
  34. Instructions for use of SAY:
  35.   - SAY( x, y, msg );
  36.      - Say is sensitive to the window command. In otherwords if a window has
  37.        been set up (Window(x1,y1,x2,y2)), x=1 and y=1 would be in the upper
  38.        left corner of the window (x1,y1)
  39.  
  40. x, y : position on screen of input msg
  41.        - if x or y are 0 input will use WhereX or/and WhereY
  42.        - if x = 90, msg will be centered in the current window/screen
  43.        - if x >= 100, msg will be right justified to x-100
  44. msg  : message to be displayed, the following command can be included
  45. `a###   = ### is a 3 digit attribute code;
  46. `c## `x## = ## is a new x (column 1..80) position
  47. `r## `y## = ## is a new y (row 1..25) position
  48. `f##      = ## is a function
  49.             01 = <CR> align left
  50.             02 = <CR> align with col 1
  51.             03 = produce a physical linefeed with WriteLn;
  52.             04 = move cursor to end when finished
  53.             05 = ignore window x,y position limitations
  54.             10..18 = slow text (10=fastest, 18=slowest)
  55.             19 = return to fast text after 10..18
  56. `m      = move cursor to end of say string when finished
  57. `h##x   = horizontal repitition ## times of the character x
  58. `=##    = print only next ## characters of this string
  59. `l##    = print only next ## characters of this string w/trailing
  60.           character if more
  61. `v##x   = vertical repitition ## times of the character x
  62. `t##    = write the character ## on the screen (for use with chr(1..31))
  63.  
  64. EXAMPLES:
  65.  
  66. Say( 90,12, SayAttr(120)+'This is centered on the screen' );
  67. Say( 10,10, '`f13This text is printed slowly across the screen' );
  68. Say( 10,11, '`f15This is slow `f19This is VERY fast (normal speed)' );
  69. Say(140,14, '`a150The right margin of this is at pos 140' );
  70. Say( 30,16, 'This is on line 16`f01This is on line 17' );
  71. Say( 50,18, 'Now at 50,18`x20`y10Now at 20,10' );
  72. Say( 01,01, '`h80-`x01`y03`h80=' );
  73. Say( 15,20, '`=20Only the first 20 char of this message are printed' );
  74. Say( 01,05, '`a001This `a002msg `a003has `a004many `a005colors' );
  75. Say( 01,06, SayAttr(1)+'This '+SayAttr(2)+'msg '+SayAttr(3)+'has '+
  76.             SayAttr(4)+'many '+SayAttr(5)+'colors' );
  77.  
  78. counter := 45;
  79. Say( 90,19, 'counter = '+ItoS(counter,0) );
  80.   displays 'counter = 45' centered on line 19
  81.  
  82. s1 := 'AG-382A-472 BLUE'
  83. Say( 20,17, 'MODEL: '+ SayLen(10)+ s1 );
  84.   displays 'MODEL: AG-382A-47' over 20 on line 17
  85.  
  86. SWrite(msg) is equivelent to Say( 0,0, msg+'`m' );
  87. SWriteLn(msg)     "          Say( 0,0, msg+'`f03' );
  88.  
  89. BStr(true) returns 'TRUE'
  90. BStr(false) returns 'FALSE'
  91. RStr(5) returns '5'
  92. RStr(38.238) returns '38.238'
  93. RStr(1.50000000000) return '1.5'
  94. ItoS(5,4) returns '   5'
  95. ItoS(3278,4) returns '3278'
  96. RtoS(47.5,6,2) returns ' 47.50'
  97.  
  98. StringOf(20,'*') returns '********************'
  99. Caps('hello') returns 'HELLO'
  100. Trim('Hello       ') returns 'Hello'
  101.  
  102.  
  103.  
  104. ---------------------------------------------------------------------
  105. KEYBOARD Unit for TP 5.5
  106.         
  107. Const - RightShift = $01;     {keyboard flags}
  108.         LeftShift  = $02;
  109.         CtrlShift  = $04;
  110.         AltShift   = $08;
  111.         ScrollLock = $10;
  112.         NumLock    = $20;
  113.         CapsLock   = $40;
  114.         InsertLock = $80;
  115. (P)  ClearKeyBuffer;
  116.              - clears the internal 125 char buffer
  117. (F)  CheckKeyboard : boolean;
  118.              - false if internal buffer is empty (used by GetKey,
  119.                can be used to dump BIOS 16 char keyboard buffer
  120.                into the internal 125 char buffer)
  121. (F)  GetKey( var func : boolean ) : char;
  122.              - returns the key pressed from the buffer (FIFO),
  123.                func returns true if it is a two-code key (F#, ALT)
  124.                GetKey returns #00 if no character waiting.
  125. (F)  GetScan( var kbdflag : byte ) : byte;
  126.              - optionally called after a GetKey, returns the scan 
  127.                code of the key; kbdflag returns the combination of
  128.                which shift keys were down when the key was pressed.
  129.  
  130. EXAMPLES:
  131.  
  132. var
  133.    ch   : char;
  134.    func : boolean;
  135.    kbd,
  136.    scan : byte;
  137.  
  138. wait for key:
  139. REPEAT
  140.    ch := GetKey( func );
  141. UNTIL (ch <> #00);
  142.  
  143. wait for key then get scan codes:
  144. REPEAT
  145.    ch := GetKey( func );
  146. UNTIL (ch <> #00)
  147. scan := GetScan( kbd );
  148.  
  149. wait for a capital A typed using the right shift key:
  150. REPEAT
  151.    ch := GetKey( func );
  152.    scan := GetScan( kbd );
  153. UNTIL (ch = 'A') and (kbd and RightShift = RightShift);
  154.  
  155.  
  156.  
  157. ---------------------------------------------------------------------
  158. COLORS Unit for TP 5.5
  159.  
  160. var
  161.    a_dh,                 { data highlight }
  162.    a_dl,                 { data lowlight, default SAY attr }
  163.    a_mh,                 { menu highlight    - used in KWINDOWS unit }
  164.    a_ml,                 { menu lowlight     - used in KWINDOWS }
  165.    a_ms,                 { menu selected     - used in KWINDOWS }
  166.    a_mn,                 { menu not selected - used in KWINDOWS }
  167.    a_st,                 { status line }
  168.    a_pr,                 { input prompt }
  169.    a_inp,                { input field  - used in KINPUT unit }
  170.    a_ed,                 { after input  - used in KINPUT }
  171.    a_border,             { border color }
  172.    a_tm,                 { time, date, etc. }
  173.    a_err,                { error messages }
  174.    a_ins      : AttrStr; { insert message }
  175.    a_back     : byte;    { background for ClrScr }
  176.    fieldblank : char;    { char for blank in Input field - used in KINPUT }
  177.  
  178. (F) GetColors( Drive : char ) : boolean;
  179.                  - reads disk file 'CONFIG.CCS' off root dir of DRIVE
  180.                    if DRIVE = 'X' then uses current disk
  181. (F) SaveColors( Drive : char ) : boolean;
  182.                  - saves colors to file 'CONFIG.CCS' in root dir of
  183.                    DRIVE.  {see GetColors}
  184.  
  185. The unit initializes the attribute strings to colors that are "OK"
  186. for both color and mono monitors so your program does not _have_ to
  187. do a GetColors at the beginning.  If you put a GetColors statement at
  188. the beginning of all your programs they will all have the same standard
  189. colors; and when you change the color file with "EDITCOLO" the colors
  190. will change in all your programs.  Very convenient.
  191.  
  192. EXAMPLES:
  193.  
  194. var
  195.    tf : boolean;
  196.  
  197. BEGIN
  198.     if (not GetColors('X'))
  199.       then tf := SaveColors('X');
  200.     TextAttr := a_back;
  201.     ClrScr;
  202.  
  203.     Say( 10,10, a_dl+ 'This is in standard data color, '+
  204.                 a_dh+ 'while this is highlighted.' );
  205.  
  206.     TextAttr := 07;
  207.     ClrScr;
  208. END.
  209.  
  210. {see/run EDITCOLO.PAS}
  211.  
  212.  
  213. ---------------------------------------------------------------------
  214. The source to this is available for $49.95.  There are also many other
  215. "K" units built around this KPASCAL unit available, including:
  216.      KINPUT    - complex keyboard entry field for
  217.                     Boolean, String, long Strings, Integers,
  218.                     Real, Dollar, Character, Yes/No.
  219.                   (uses KPASCAL, KEYBOARD, COLORS, {KDATES})
  220.      KWINDOWS  - windowing system for overlaping windows also has
  221.                  Menus and Selection windows.  Uses Object Oriented Prog.
  222.                   (uses KPASCAL, KEYBOARD, COLORS)
  223.      KDATES    - Date manipulation, similar to functions in DBase
  224.                  plus others.
  225.      KTIMES    - Similar to KDATES except with Time.
  226.      KHELP     - Pop up context sensitive help screens.  Req KWindows.
  227.                   (uses KPASCAL, KEYBOARD, KWINDOWS)
  228.   Others include:
  229.      KSCREEN, KMOUSE, KFILES, KBIT, KEMS;
  230.  
  231. Please write to:
  232.                 Contemporary Computer Services
  233.                 P.O. Box 308
  234.                 Sylvania, OH  43560-0308
  235.              (or EMAIL with your address to 73457,2221)
  236. for further information, (or EMail me your ideas/opinions).
  237.  
  238.          ----------------end-of-author's-documentation---------------
  239.  
  240.                         Software Library Information:
  241.  
  242.                    This disk copy provided as a service of
  243.  
  244.                         The Public (Software) Library
  245.  
  246.          We are not the authors of this program, nor are we associated
  247.          with the author in any way other than as a distributor of the
  248.          program in accordance with the author's terms of distribution.
  249.  
  250.          Please direct shareware payments and specific questions about
  251.          this program to the author of the program, whose name appears
  252.          elsewhere in  this documentation. If you have trouble getting
  253.          in touch with the author,  we will do whatever we can to help
  254.          you with your questions. All programs have been tested and do
  255.          run.  To report problems,  please use the form that is in the
  256.          file PROBLEM.DOC on many of our disks or in other written for-
  257.          mat with screen printouts, if possible.  The P(s)L cannot de-
  258.          bug programs over the telephone.
  259.  
  260.          Disks in the P(s)L are updated monthly, so if you did not get
  261.          this disk  directly from the P(s)L,  you should be aware that
  262.          the files in this set may no  longer be the current versions.
  263.  
  264.          For a copy of the latest monthly software library newsletter
  265.          and a list of the 2,000+ disks in the library, call or write
  266.  
  267.                         The Public (Software) Library
  268.                               P.O.Box 35705 - F
  269.                            Houston, TX 77235-5705
  270.                                (713) 665-7017
  271.  
  272.